<script setup lang="ts">
import { inject } from "vue";
const car = inject("car");

const handler = () => {
  car.value = "自行车";
};
</script>

<template>
  <div class="grand">
    <h3>孙组件</h3>
    <div>爷爷的车：{{ car }}</div>
    <div><button @click="handler">修改数据</button></div>
  </div>
</template>

<style scoped>
.grand {
  width: 95%;
  min-height: 390px;
  background: brown;
  padding: 0.5rem;
  color: bisque;
  margin: 0.5rem auto 0.5rem auto;
}
</style>
